<template>
	<view>
		<view class="u-flex  u-p-l-20 u-p-r-10" style="border: 1px solid #ff551a; border-radius: 20rpx;" >
			<view class="iconfont icon-tianmao4" style="color:#ff551a;font-size: 48rpx;margin-right: 10rpx;" @click="openTm()"></view>
			<u-icon name="arrow-right" color="#ff551a" size="20"></u-icon>
		</view>
	</view>
</template>

<script lang="uts">
		import { openUrlFn } from '@/uni_modules/llx-openapp'
	export default { 
		name:"open-tmall",
		props:{
			tmallUrl:{
				type:String,
				default:''
			}
		},
		methods:{
			openTm(){
			 // #ifdef APP-PLUS
				if (plus.os.name == 'Android') {
					plus.runtime.launchApplication(  
						{  
							pname: 'com.tmall.wireless'  
						},  
						function(e) {  
							this.$u.toast('打开天猫失败')
							console.log('Open system default browser failed: ' + e.message);  
						}   
					);  
				} else if (plus.os.name == 'iOS') {  
					plus.runtime.launchApplication({ action: 'tmall://' }, function(e) {  
						this.$u.toast('打开天猫失败')
						console.log('Open system default browser failed: ' + e.message);  
					});   
				}
				// #endif
				// #ifdef APP-HARMONY
				console.log('asdasd');
					openUrlFn(this.tmallUrl)
				// #endif
				// #ifndef APP-PLUS
					window.open(this.tmallUrl)
				// #endif 
			},
		}
	}
</script>

<style>
	@import "@/static/iconfont/iconfont.css";
</style>